package com.jwds.digital.bios.business.service.rule.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.jwds.digital.bios.business.core.constants.RuleCodeConstant;
import com.jwds.digital.bios.business.core.infrastructure.dto.dispatch.DispatchConfiguratReqDTO;
import com.jwds.digital.bios.business.core.infrastructure.dto.dispatch.DispatchParameterReqDTO;
import com.jwds.digital.bios.business.core.infrastructure.dto.feign.BasicStockBinReqDTO;
import com.jwds.digital.bios.business.core.infrastructure.entity.dispatch.DispatchConfigurat;
import com.jwds.digital.bios.business.core.infrastructure.mapper.dispatch.DispatchConfiguratMapper;
import com.jwds.digital.bios.business.rpc.feign.BasicStockBinFeign;
import com.jwds.digital.bios.business.service.rule.DispatchRuleSortInterface;
import com.jwds.digital.bios.business.service.service.dispatch.IDispatchConfiguratService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
/*
*
*终点设备
* */
@Slf4j
@Component
public class DestDeviceDemo implements DispatchRuleSortInterface {
    @Autowired
    DispatchConfiguratMapper dispatchConfiguratMapper;
    @Autowired
    private BasicStockBinFeign basicStockBinFeign;

    @Autowired
    IDispatchConfiguratService dispatchConfiguratService;

    @Override
    public String getRuleCode() {
        //return RuleCodeConstant.RULE_DEMO1;
        return null;
    }

    @Override
    public List<DispatchParameterReqDTO> sortProcess(List<DispatchParameterReqDTO> dataList) {
        List<DispatchParameterReqDTO> resultList = new ArrayList<>();
//        查询仓的所有信息
        List<BasicStockBinReqDTO> list= (List<BasicStockBinReqDTO>) basicStockBinFeign.list((BasicStockBinReqDTO) dataList);
        //查询所有规则
        List<DispatchConfiguratReqDTO> stockBinList = null;
        for (BasicStockBinReqDTO basicStockBinReqDTO : list) {
            stockBinList = stockBinList.stream().
                    filter(record -> !record.getGroupCode().equals(basicStockBinReqDTO.getGroupCode()))
                    .collect(Collectors.toList());
        }
        for (DispatchConfiguratReqDTO dispatchConfiguratRespVO : stockBinList) {
           // List<BasicStockBinReqDTO> dispatchConfiguratReqDTOS = dispatchConfiguratService.ScraperMachine((List<BasicStockBinReqDTO>) dispatchConfiguratRespVO);
            //resultList.add((DispatchParameterReqDTO) dispatchConfiguratReqDTOS);
        }
        return resultList;
    }


}
